import { ref, computed, reactive } from 'vue'
import { defineStore } from 'pinia'
import { getUserInfo } from '@/api/userInfo'



export const useUserInfo = defineStore('userInfo', () => {
  const state = reactive({
    image_url: '',
    name: '',
    sex: '',
    department: '',
    identity: '',
    account: '',
    email: '',
    id: ''
  })

  const userInfo = async (id) => {
    const res = await getUserInfo({id})
    Object.assign(state, res.data)
  }
  

  return { state, userInfo }
})
